package com.yanqu.road.server.cmd.activity.celebration;

import com.yanqu.road.pb.celebration.CelebrationProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.activity.celebration.CelebrationMgr;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.Protocol;

/**
 * @Description
 * @Author cwq
 * @Data 2022/4/24 16:01
 */
@Cmd(code = Protocol.C2_CELEBRATION_DATA, desc = "庆典建筑数据 （进入活动）")
public class CrossCelebrationEnter extends CrossCommand {

    int activityId;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        CelebrationProto.CelebrationGetProgressReqMsg reqMsg = CelebrationProto.CelebrationGetProgressReqMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        MessageHelper.sendPacket(serverId, packet.getPlayerId(), YanQuMessageUtils.buildMessage(ClientProtocol.U_CELEBRATION_DATA, CelebrationMgr.enter(activityId)));
    }

    @Override
    public void sendData() {

    }
}
